import http from '@/utils/httpRequest'
import ApiUrl from '@/constant/api-url'
let config = {
  headers: {
    'Content-Type': 'multipart/form-data;charset=utf-8'
  },
  transformRequest: [function (data) {
    return data
  }]
}

const operationApi = {
  /**
     * 日报列表
     * @param params
     * @returns {AxiosPromise}
     */
  getDailyList: function (params) {
    return http({
      baseURL: ApiUrl.API_HOST_BASE,
      url: http.adornUrl('api/operation/list'),
      method: 'post',
      params: http.adornParams(params)
    })
  },
  /**
     * 导入数据
     * @returns {AxiosPromise}
     */
  uploadData: function (params) {
    return http({
      url: http.adornUrl('api/operation/import'),
      method: 'post',
      timeout: 20000,
      data: params,
      config
    })
  },
  /**
   * 导出记录
   */
  doExport: function (data) {
    return http({
      baseURL: ApiUrl.API_HOST_BASE,
      url: http.adornUrl('api/operation/export'),
      method: 'post',
      data: http.adornData(data),
      responseType: 'blob'
    })
  },
  /**
   * 删除用户
   * @param ids
   * @returns {AxiosPromise}
   */
  deleteUser: function (ids) {
    return http({
      url: http.adornUrl('api/operation/delete'),
      method: 'post',
      data: ids
    })
  },
  /**
   * 用户详情
   * @param id
   * @returns {AxiosPromise}
   */
  getStatisticInfo: function (id) {
    return http({
      url: http.adornUrl('api/operation/info/' + id),
      method: 'get',
      params: http.adornParams()
    })
  },
  /**
   * 修改信息
   * @param data
   * @returns {AxiosPromise}
   */
  updateStatistic: function (data) {
    return http({
      url: http.adornUrl('api/operation/update'),
      method: 'post',
      data: http.adornData(data)
    })
  }


}

export default operationApi
